<?php
use yii\db\Schema;
use yii\db\Migration;

class m160426_034306_role_access extends Migration
{
    public function up()
    {
    	$this->createTable('role_access', [
    			'id' => Schema::TYPE_PK,
    			'module' => Schema::TYPE_STRING . "(255) NOT NULL comment '控制器名称'",
    			'action' => Schema::TYPE_STRING . "(255) NOT NULL comment '控制器方法'",
    			'role_id' => Schema::TYPE_INTEGER."(11) comment '角色id值'",
    	]);
    	
    	$this->createIndex('role_id', 'role_access', ['role_id']);
    }

    public function down()
    {
        echo "m160426_034306_role_access cannot be reverted.\n";

        return false;
    }

    /*
    // Use safeUp/safeDown to run migration code within a transaction
    public function safeUp()
    {
    }

    public function safeDown()
    {
    }
    */
}
